package edu.moravian.math;

import java.util.Random;

/**
 * This is a helper class to create random values in a given range.
 * Its use is similar to Math.random() but you specify a range
 *
 * @author Elliot
 */
public class Rand
{
    private static Random rand = new Random();

    /**
     * Get an int in the range [low, high)
     *
     * @param low the inclusive low end
     * @param high the exclusive high end
     *
     * @return int in the range [low, high)
     */
    public static int inRange(int low, int high)
    {
        return rand.nextInt((high - low)) + low;
    }




    /**
     * Get a double in the range [low, high)
     *
     * @param low the inclusive low end
     * @param high the exclusive high end
     *
     * @return double in the range [low, high)
     */
    public static double inRange(double low, double high)
    {
        return rand.nextDouble() * (high - low) + low;
    }




}



